package com.usian.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.usian.mapper.OrderMapper;
import com.usian.service.IOrderService;
import com.usian.shop.entity.Order;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2024-01-10
 */
@Slf4j
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {
@Autowired
private OrderMapper orderMapper;
    @Override
    public PageInfo findAll(Integer pageNum, Integer pageSize, Order order) {
        PageHelper.startPage(pageNum,pageSize);
//        LambdaQueryWrapper<Order> qw = new LambdaQueryWrapper<>();
//        if (StringUtils.isNotBlank(order.getGname())){
//            qw.like(Order::getGname,order.getGname());
//        }
//        if (order.getStart()!=null){
//            qw.ge(Order::getCreatetime,order.getStart());
//        }
//        if (order.getEnd()!=null){
//            qw.le(Order::getCreatetime,order.getEnd());
//        }
        List<Order> orders = orderMapper.selectLists(order);
        return new PageInfo(orders);
    }
}
